package com.hzlj.position.locate.common.dto.reportInspectionArtificial;


import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fz.common.base.enums.db.ResultField;
import com.fz.common.dict.annotation.Dict;
import com.hzlj.position.locate.common.model.ReportInspectionArtificial;
import com.hzlj.sqjz.jz.common.dto.common.JzCommonQueryResultDTO;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.Date;

import static com.fz.common.base.core.date.DateUtils.*;

/**
 * 通信联络核查-核查-最新(ReportInspectionArtificial)查询结果返回DTO
 *
 * @author lifh
 * @date 2023-08-04 17:26:54
 */
@Data
@ToString
@Accessors(chain = true)
public class ReportInspectionArtificialWithJzJbxxDTO extends JzCommonQueryResultDTO {
    /**
     * 主键
     */
    @ResultField(ReportInspectionArtificial.class)
    private String id;
    /**
     * 最新的核查ID(report_inspection)
     */
    @ResultField(ReportInspectionArtificial.class)
    private String inspectionId;
    /**
     * 所属天
     */
    @ResultField(ReportInspectionArtificial.class)
    @JsonFormat(locale = LOCALE, timezone = TIME_ZONE, pattern = DATE_SHORT_FORMAT)
    private Date belongDay;
    /**
     * 人工上报状态,dict-REPORT_STATUS
     */
    @ResultField(ReportInspectionArtificial.class)
    @Dict(value = "REPORT_STATUS")
    private String reportStatus;
    /**
     * 人工上报状态,dict-REPORT_STATUS(文本)
     */
    private String reportStatusText;
    /**
     * 纬度
     */
    @ResultField(ReportInspectionArtificial.class)
    private String latitude;
    /**
     * 经度
     */
    @ResultField(ReportInspectionArtificial.class)
    private String longitude;
    /**
     * 上报时间
     */
    @ResultField(ReportInspectionArtificial.class)
    private Date reportTime;
    /**
     * 上报地址
     */
    @ResultField(ReportInspectionArtificial.class)
    private String reportAddress;
    /**
     * 上报的现场图片
     */
    @ResultField(ReportInspectionArtificial.class)
    private String fileIds;
    /**
     * 点验通知是否发送成功
     */
    @ResultField(ReportInspectionArtificial.class)
    private Boolean notice;
    /**
     * 点验通知是否发送失败原因
     */
    @ResultField(ReportInspectionArtificial.class)
    private String noticeFailMsg;
    /**
     * 核查时间
     */
    @ResultField(ReportInspectionArtificial.class)
    private Date spotCheckTime;
    /**
     * 是否越界
     */
    @ResultField(ReportInspectionArtificial.class)
    private Boolean crossBorder;
    /**
     * 发起核查的次数
     */
    @ResultField(ReportInspectionArtificial.class)
    private Integer inspectionAmt;
    /**
     * 创建者JgCode
     */
    @ResultField(ReportInspectionArtificial.class)
    private String creatorJgCode;
    /**
     * 创建者JgMc
     */
    @ResultField(ReportInspectionArtificial.class)
    private String creatorJgMc;

    public String getNoticeText() {
        if (ObjectUtil.isEmpty(notice)) {
            return "/";
        }
        return Boolean.TRUE.equals(notice) ? "已下发" : "下发失败";
    }

    public String getCrossBorderText() {
        if (ObjectUtil.isEmpty(crossBorder)) {
            return "/";
        }
        return Boolean.TRUE.equals(crossBorder) ? "越界" : "正常";
    }
}